package com.newly.api.business.feign;

import com.newly.common.base.constants.ServerUriConstant;
import com.newly.common.base.entity.R;
import com.newly.common.base.entity.business.Dto.CarDto;
import com.newly.common.base.entity.business.Dto.CarListDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

/**
 * @anthor sbq
 * @date 2021/10/26 11:29
 */
@Api(tags = "车辆信息管理api")
@FeignClient(path = ServerUriConstant.NEWLY_BUSINESS_CAR, name = ServerUriConstant.NEWLY_BUSINESS_SERVICE_NAME)
public interface VehicleClient {

    @ApiOperation("获取车辆信息导入模版")
    @GetMapping("/getTemplate")
    void getTemplate(HttpServletResponse response);

    @ApiOperation("导出车辆信息")
    @GetMapping("/export")
    void export(HttpServletResponse response, CarListDto carListDto);

    @ApiOperation("导入车辆信息")
    @PostMapping("/import")
    R importVehicle(@RequestParam("file") MultipartFile file);

    @ApiOperation("分页查询车辆列表")
    @GetMapping("/getPage")
    R getPage(CarListDto carListDto);

    @ApiOperation("根据车牌号查询记录和违法历史")
    @GetMapping("/getListByCarNumber")
    R getListByCarNumber(String carNumber, Integer offset);

    @ApiOperation("编辑车辆信息")
    @PostMapping("/edit")
    R edit(@Valid @RequestBody CarDto carDto);


    @ApiOperation("保存一条记录")
    @PostMapping("/save")
    R save(@Valid @RequestBody CarDto carDto);

    @ApiOperation("批量删除")
    @PostMapping("/delete")
    R delete(@RequestBody Long[] ids);

    @ApiOperation("车牌号是否重复")
    @GetMapping("/repeat")
    R repeat(String carNumber);

    @ApiOperation("设置黑名单")
    @GetMapping("/setBlackName")
    R setBlackName(String id, String carNumber, Boolean isBlackName);
}
